package com.lj.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lj.mapper.DirectorljMapper;
import com.lj.mapper.ManagerljMapper;
import com.lj.pojo.Directorlj;
import com.lj.pojo.DirectorljExample;
import com.lj.pojo.Managerlj;
import com.lj.pojo.ManagerljExample;
import com.lj.service.DirectorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DirectorServiceImpl implements DirectorService {
    @Autowired
    DirectorljMapper directorljMapper;
    @Override
    public PageInfo selectDirector(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        DirectorljExample example=new DirectorljExample();
        example.setOrderByClause("director_id desc");
        List<Directorlj> list=directorljMapper.selectByExample(example);
        PageInfo<Directorlj> pageInfo=new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public int insertDirector(Directorlj directorlj) {
        return directorljMapper.insert(directorlj);
    }

    @Override
    public int delete(String id) {
        return directorljMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Directorlj getById(String id) {
        return directorljMapper.selectByPrimaryKey(id);
    }

    @Override
    public int update(Directorlj directorlj) {
        return directorljMapper.updateByPrimaryKey(directorlj);
    }
}
